export const basicFields = [
  {
    type: 'input',
    name: '文本输入',
    icon: 'input-text',
    options: {
      name: '',
      label: '',
      defaultValueType: 0, // 0自定义 1公式编辑
      defaultValue: '',
      defaultValueFunc: '', // 公式表达式
      maxlength: '20',
      showWordLimit: false,
      placeholder: '可以填写任意文本',
      append: '',
      disabled: false,
      readonly: false,
      clearable: false,
      workflow: true, // 加入审批流程条件使用
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'textarea',
    name: '多行输入',
    icon: 'input-textarea',
    options: {
      name: '',
      label: '',
      defaultValue: '',
      maxlength: '3000',
      rows: 3,
      autosize: true,
      showWordLimit: true,
      ellipsis: 3, // 详情展示的行数
      expandTips: '展开',
      retractTips: '收起',
      placeholder: '可以填写任意文本',
      disabled: false,
      readonly: false,
      workflow: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'number',
    name: '数字输入',
    icon: 'input-number',
    options: {
      name: '',
      label: '',
      defaultValue: 0,
      min: 0,
      max: 9999,
      placeholder: '只能填写数字',
      append: '',
      disabled: false,
      readonly: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'radio',
    name: '单项选择',
    icon: 'input-radio',
    options: {
      name: '',
      label: '',
      defaultValue: '1',
      optionItems: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' },
        { label: '选项三', value: '3' }
      ],
      inline: true, // 是否显示为一行
      disabled: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'checkbox',
    name: '多项选择',
    icon: 'input-checkbox',
    options: {
      name: '',
      label: '',
      defaultValue: [],
      optionItems: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' },
        { label: '选项三', value: '3' }
      ],
      inline: true, // 是否显示为一行
      disabled: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'select',
    name: '选择列表',
    icon: 'input-select',
    options: {
      name: '',
      label: '',
      defaultValue: '1',
      optionItems: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' },
        { label: '选项三', value: '3' }
      ],
      placeholder: '请选择',
      disabled: false,
      clearable: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'checkboxlist',
    name: '下拉复选框',
    icon: 'input-checkboxlist',
    options: {
      name: '',
      label: '',
      defaultValue: [],
      optionItems: [
        { label: '选项一', value: '1' },
        { label: '选项二', value: '2' },
        { label: '选项三', value: '3' }
      ],
      placeholder: '请选择',
      collapseTags: true, // 多选时折叠标签
      maxCollapseTags: 3, // 最多显示多少个标签
      ellipsis: false, // 显示省略号
      disabled: false,
      clearable: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'time',
    name: '时间选择',
    icon: 'input-time',
    options: {
      name: '',
      label: '',
      defaultValue: '',
      format: '', // 时间格式
      placeholder: '请选择',
      disabled: false,
      readonly: false,
      clearable: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'date',
    name: '日期选择',
    icon: 'input-date',
    options: {
      name: '',
      label: '',
      defaultValue: '',
      type: 'date',
      format: 'YYYY-MM-DD',
      placeholder: '请选择',
      disabled: false,
      readonly: false,
      clearable: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'cascader',
    name: '级联选择',
    icon: 'input-cascader',
    options: {
      name: '',
      label: '',
      defaultValue: [],
      optionItems: [
        { label: '部门一', value: '1', children: [{ label: '子部门', value: '11' }] },
        { label: '部门二', value: '2' },
        { label: '部门三', value: '3 ' }
      ],
      placeholder: '',
      disabled: false,
      readonly: false,
      clearable: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'divider',
    name: '分割线',
    icon: 'divider',
    options: {
      name: '',
      direction: 'horizontal', // 分割线的方向，支持horizontal和vertical
      title: '', // 标题
      titlePosition: 'center', // 分割线的标题位置，支持left、center和right
      lineStyle: 'solid' // 分割线的样式，支持dashed和solid
    }
  },
  {
    type: 'picture',
    name: '图片',
    icon: 'input-picture',
    options: {
      name: '',
      label: '',
      inputAlign: 'left',
      defaultValue: [],
      action: '/api/basic/image-manage/upload',
      actionBlob: '/api/basic/image-manage',
      camera: false, // 手机端仅拍照上传
      reduce: 1, // 使用压缩图片上传 0原图 1高清无损 2高质量
      limit: 10,
      fileMaxSize: 10,
      accept: '',
      tip: '最多上传10个图片',
      disabled: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'fileupload',
    name: '附件',
    icon: 'input-fileupload',
    options: {
      name: '',
      label: '',
      inputAlign: 'left',
      defaultValue: [],
      action: '/api/basic/image-manage/upload',
      actionBlob: '/api/basic/image-manage',
      limit: 5,
      fileMaxSize: 20,
      listType: 'picture',
      accept: '',
      tip: '最多上传5个附件',
      disabled: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'signature',
    name: '签名',
    icon: 'input-signature',
    options: {
      name: '',
      label: '',
      type: 'png',
      penColor: '#000',
      lineWidth: 3,
      backgroundColor: '',
      clearButtonText: '清空',
      confirmButtonText: '确认',
      signText: '点击去签名',
      reSignText: '重新签名',
      disabled: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'phone',
    name: '手机',
    icon: 'input-phone',
    options: {
      name: '',
      label: '',
      placeholder: '请输入手机号',
      pattern: '请输入有效的手机号码',
      readonly: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  }
]

export const complexFields = [
  {
    type: 'computedays',
    name: '计算时长',
    icon: 'input-number',
    options: {
      name: '',
      label: '',
      defaultValue: '',
      type: 'number',
      placeholder: '',
      append: '天',
      selectStart: '', // 关联开始日期
      selectEnd: '', // 关联结束日期
      workdayMode: 1, // 0自然日 1工作日
      holidays: [
        '2025-01-01', // 元旦
        '2025-01-29', // 春节
        '2025-01-30', // 春节
        '2025-01-31', // 春节
        '2025-02-01', // 春节
        '2025-02-02', // 春节
        '2025-02-03', // 春节
        '2025-04-04', // 清明节
        '2025-04-05', // 清明节
        '2025-04-06', // 清明节
        '2025-05-01', // 劳动节
        '2025-05-02', // 劳动节
        '2025-05-03', // 劳动节
        '2025-06-07', // 端午节
        '2025-06-08', // 端午节
        '2025-06-09', // 端午节
        '2025-09-13', // 中秋节
        '2025-09-14', // 中秋节
        '2025-09-15', // 中秋节
        '2025-10-01', // 国庆节
        '2025-10-02', // 国庆节
        '2025-10-03', // 国庆节
        '2025-10-04', // 国庆节
        '2025-10-05', // 国庆节
        '2025-10-06', // 国庆节
        '2025-10-07' // 国庆节
      ],
      workdays: [
        '2025-02-08', // 调休工作日（春节）
        '2025-02-09', // 调休工作日（春节）
        '2025-04-27', // 调休工作日（劳动节）
        '2025-05-04', // 调休工作日（劳动节）
        '2025-09-28', // 调休工作日（国庆节）
        '2025-10-11' // 调休工作日（国庆节）
      ],
      workTime: [
        { start: '09:00', end: '12:00' },
        { start: '13:00', end: '18:00' }
      ],
      workflow: true,
      required: true,
      requiredMessage: '不能为空！'
    },
    hideOptions: ['required', 'requiredMessage']
  },
  {
    type: 'card',
    name: '请假组件',
    icon: 'card-leave',
    options: {
      name: 'leave',
      publicVars: {}
    },
    components: [
      {
        type: 'select',
        name: '选择器',
        icon: 'input-select',
        options: {
          name: 'Type',
          label: '请假类型',
          defaultValue: '',
          optionItems: [
            { label: '年假', value: '1' },
            { label: '事假', value: '2' },
            { label: '病假', value: '3' },
            { label: '调休假', value: '4' },
            { label: '婚假', value: '5' },
            { label: '丧假', value: '6' },
            { label: '产假', value: '7' },
            { label: '陪产假', value: '8' },
            { label: '产检假', value: '9' },
            { label: '哺乳假', value: '10' },
            { label: '陪考假', value: '11' },
            { label: '其他', value: '12' }
          ],
          placeholder: '请选择',
          workflow: true,
          required: true,
          requiredMessage: '请选择请假类型'
        },
        hideOptions: ['source', 'action', 'max', 'required', 'requiredMessage']
      },
      {
        type: 'date',
        name: '日期选择',
        icon: 'input-date',
        options: {
          name: 'BTime',
          label: '开始时间',
          defaultValue: '',
          type: 'datetime',
          format: 'YYYY-MM-DD HH:mm',
          placeholder: '请选择',
          required: true,
          requiredMessage: '请选择开始时间'
        },
        hideOptions: ['defaultValue', 'required', 'requiredMessage'],
        events: {
          onValidate:
            'const { BTime, ETime } = formData;\r\nif(BTime && ETime) {\r\n  const startTime = new Date(BTime.replace(/\\s/, "T")); // 开始时间\r\n  const endTime = new Date(ETime.replace(/\\s/, "T")); // 结束时间\r\n  if(startTime >= endTime) {\r\n    callback(\'开始时间不能大于结束时间\')\r\n  }\r\n}\r\ncallback()'
        }
      },
      {
        type: 'date',
        name: '日期选择',
        icon: 'input-date',
        options: {
          name: 'ETime',
          label: '结束时间',
          defaultValue: '',
          type: 'datetime',
          format: 'YYYY-MM-DD HH:mm',
          placeholder: '请选择',
          required: true,
          requiredMessage: '请选择结束时间'
        },
        hideOptions: ['defaultValue', 'required', 'requiredMessage']
      },
      {
        type: 'computedays',
        name: '计算时长',
        icon: 'input-number',
        options: {
          name: 'leaveDays',
          label: '请假时长',
          defaultValue: '',
          type: 'number',
          placeholder: '',
          append: '天',
          selectStart: 'BTime',
          selectEnd: 'ETime',
          workdayMode: 1,
          holidays: [
            '2025-01-01',
            '2025-01-29',
            '2025-01-30',
            '2025-01-31',
            '2025-02-01',
            '2025-02-02',
            '2025-02-03',
            '2025-04-04',
            '2025-04-05',
            '2025-04-06',
            '2025-05-01',
            '2025-05-02',
            '2025-05-03',
            '2025-06-07',
            '2025-06-08',
            '2025-06-09',
            '2025-09-13',
            '2025-09-14',
            '2025-09-15',
            '2025-10-01',
            '2025-10-02',
            '2025-10-03',
            '2025-10-04',
            '2025-10-05',
            '2025-10-06',
            '2025-10-07'
          ],
          workdays: ['2025-02-08', '2025-02-09', '2025-04-27', '2025-05-04', '2025-09-28', '2025-10-11'],
          workTime: [
            { start: '09:00', end: '12:00' },
            { start: '13:00', end: '18:00' }
          ],
          workflow: true
        },
        hideOptions: ['defaultValue', 'selectStart', 'selectEnd']
      },
      {
        type: 'textarea',
        name: '多行输入',
        icon: 'input-textarea',
        options: {
          name: 'remark',
          label: '请假事由',
          labelPosition: 'top',
          inputAlign: 'left',
          defaultValue: '',
          maxlength: '100',
          rows: 3,
          autosize: true,
          placeholder: '请输入',
          required: false,
          requiredMessage: '不能为空！'
        },
        hideOptions: ['defaultValue', 'required', 'requiredMessage']
      },
      {
        type: 'fileupload',
        name: '附件',
        icon: 'input-fileupload',
        options: {
          name: 'file',
          label: '附件',
          labelPosition: 'top',
          inputAlign: 'left',
          defaultValue: [],
          action: '/api/basic/image-manage/upload',
          actionBlob: '/api/basic/image-manage',
          limit: 5,
          fileMaxSize: 20,
          listType: 'picture-card',
          accept: '',
          tip: '最多上传5个附件',
          disabled: false,
          required: false,
          requiredMessage: '不能为空！'
        },
        hideOptions: ['disabled']
      }
    ]
  },
  {
    type: 'card',
    name: '自定义组件',
    icon: 'card',
    options: {
      name: '',
      publicVars: {}
    },
    components: []
  },
  {
    type: 'correlation',
    name: '关联审批',
    icon: 'input-correlation',
    options: {
      name: '',
      label: '',
      defaultValue: [],
      selectType: false, // 可选范围 默认全部
      selectRange: [], // 选择审批
      limit: 10, // 最大数量
      tip: '最多关联10个审批', // 提示
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'amount',
    name: '金额',
    icon: 'input-amount',
    options: {
      name: '',
      label: '',
      min: 0,
      max: 999999999999999,
      decimalPlaces: 2, // 精度
      omitEndZero: true, // 省略末尾0
      placeholder: '请输入金额',
      readonly: false,
      workflow: true,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'upperamount',
    name: '大写金额',
    icon: 'input-upperamount',
    options: {
      name: '',
      label: '',
      defaultValue: '',
      maxlength: '20',
      selectSumName: '', // 关联金额
      placeholder: '请输入大写金额',
      readonly: false,
      required: false,
      requiredMessage: '不能为空！'
    }
  },
  {
    type: 'subform',
    name: '子表单',
    icon: 'input-subform',
    options: {
      name: '',
      label: '',
      defaultValue: [],
      draggable: false,
      addable: false,
      removable: false,
      disabled: false,
      readonly: false,
      required: false,
      requiredMessage: '不能为空！',
      // 子表单项
      formItems: [
        {
          type: 'input',
          name: '文本输入',
          icon: 'input-text',
          options: {
            name: 'input80680',
            label: '标题1',
            defaultValueType: 0,
            defaultValue: '',
            defaultValueFunc: '',
            maxlength: '20',
            showWordLimit: false,
            placeholder: '可以填写任意文本',
            append: '',
            disabled: false,
            readonly: false,
            clearable: false,
            workflow: false,
            required: false,
            requiredMessage: '不能为空！'
          }
        },
        {
          type: 'input',
          name: '文本输入',
          icon: 'input-text',
          options: {
            name: 'input80681',
            label: '标题2',
            defaultValueType: 0,
            defaultValue: '',
            defaultValueFunc: '',
            maxlength: '20',
            showWordLimit: false,
            placeholder: '可以填写任意文本',
            append: '',
            disabled: false,
            readonly: false,
            clearable: false,
            workflow: false,
            required: false,
            requiredMessage: '不能为空！'
          }
        }
      ]
    }
  }
]
